import {createRouter,createWebHistory} from 'vue-router'
//导入组件
import LoginVue from "@/views/UserLogin.vue";
import HomeVue from "@/views/home/HomeIndex.vue"
import CartIndex from "@/views/individual/CartIndex.vue";
import OrderIndex from "@/views/individual/OrderIndex.vue";
import LayOut from "@/views/individual/LayOut.vue";
import BaLogin from "@/views/backend/BackendLogin.vue"
import BLayOut from "@/views/backend/BLayOut.vue"
import BManage from "@/views/backend/BrandManage.vue"
import PManage from "@/views/backend/ProductManage.vue"
import UManage from "@/views/backend/UserManage.vue"
import CouponManage from "@/views/backend/CouponManage.vue"
import OrderManage from "@/views/backend/OrderManage.vue"
import NewsManage from "@/views/backend/NewsManage.vue"

//定义路由关系
const routes=[
    {path:"/login",component:LoginVue},
    {path:"/",component:HomeVue,//redirect:"/home",
        children:[

        ]},
    {path:"/layout",component:LayOut,children: [{path:"/layout/cart",component:CartIndex},{path: "/layout/order",component: OrderIndex}]},
    {path: "/backend/login" ,component:BaLogin},
    {path: "/backend/index" ,component: BLayOut,
        children: [
            {path: "/Backend/brand",component: BManage},
            {path: "/Backend/product", component: PManage},
            {path: "/Backend/user", component: UManage},
            {path: "/Backend/coupon", component: CouponManage},
            {path: "/Backend/order", component: OrderManage},
            {path: "/Backend/news", component: NewsManage},
        ]}
]

//创建路由器
const router=createRouter({
    history:createWebHistory(),
    routes:routes
})

export default router;